package serviceimpl;

import mapper.UserMapper;
import mapper.UserMapperCustom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import po.User;
import service.UserService;
import test.mapper.UserMapperCustomTest;
import vo.UserCustom;
import vo.UserQueryVo;

import java.io.Serializable;
import java.util.List;

/**
 * Created by apple on 2017/10/9.
 */

@Component
public class UserServiceImpl implements UserService{


    @Autowired
    private UserMapper userMapper;

    @Override
    public boolean loginCheck(String username, String password) {
        if (userMapper.selectUserByNameAndPassword(username, password) != null)
            return true;
        else
            return false;
    }

    @Override
    public boolean loginUser(String username, String password) {
        return false;
    }

    @Override
    public boolean signupCheck(String username) {
        if (userMapper.selectUserByName(username) != null)
            return false;
        else
            return true;
    }

    @Override
    public boolean signupUser(User user) {
        if (signupCheck(user.getUsername())) {
            userMapper.insertUser(user);
            return true;
        } else
            return false;

    }

}
